package com.mark.springsecurity.dto.req.vo;

import com.mark.springsecurity.domain.SysAuthority;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysAuthorityVo {

    private Long id;

    private String name;

    private String value;

    public static SysAuthority buildAuthority(SysAuthorityVo sysAuthorityVo) {
        return SysAuthority.builder()
                .id(sysAuthorityVo.getId())
                .name(sysAuthorityVo.getName())
                .value(sysAuthorityVo.getValue())
                .build();
    }

    public static SysAuthorityVo build(SysAuthority sysAuthority) {
        return SysAuthorityVo.builder()
                .id(sysAuthority.getId())
                .name(sysAuthority.getName())
                .value(sysAuthority.getValue())
                .build();
    }

}
